package com.lin.reggie.utils;

/**
 * @auther lin
 * @create 2022-05-27 14:35
 * 基于ThreaLocal的一个封装类，用来保存和获取当前登录用户的id
 *
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal=new ThreadLocal<>();

    //设置用户id
    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }
    //保存用户id
    public static Long getCurrentId(){
        return threadLocal.get();
    }
}
